import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/Layout', // 重定向:重新指向其它path,会改变网址
  },

  {
    path: '/Layout',
    name: 'Layout',
    component: () =>
      import(/* webpackChunkName: "about" */ '../Layout/index.vue'),
    children: [
      {
        path: '/logo',
        name: 'logo',
        component: () =>
          import(/* webpackChunkName: "about" */ '../views/Logo/Logo'),
      },
      {
        path: '/user',
        name: 'user',
        component: () => import('../views/用户管理/User.vue'),
      },
      {
        path: '/role',
        name: 'role',
        component: () => import('../views/角色管理/Role.vue'),
      },

      {
        path: '/train',
        name: 'train',
        component: () =>
          import(/* webpackChunkName: "about" */ '../views/车次管理/Train.vue'),
      },
      {
        path: '/station',
        name: 'station',
        component: () =>
          import(
            /* webpackChunkName: "about" */ '../views/车站管理/Station.vue'
          ),
      },
      {
        path: '/circuit',
        name: 'circuit',
        component: () =>
          import(
            /* webpackChunkName: "about" */ '../views/线路管理/Circuit.vue'
          ),
      },
      {
        path: '/ticket',
        name: 'ticket',
        component: () =>
          import(
            /* webpackChunkName: "about" */ '../views/车票管理/Ticket.vue'
          ),
      },
      {
        path: '/indent',
        name: 'indent',
        component: () =>
          import(
            /* webpackChunkName: "about" */ '../views/订单管理/Indent.vue'
          ),
      },
      {
        path: '/trajectory',
        name: 'trajectory',
        component: () =>
          import(
            /* webpackChunkName: "about" */ '../views/个人轨迹监控/Trajectory.vue'
          ),
      },
      {
        path: '/addTrain',
        name: 'addTrain',
        component: () =>
          import(
            /* webpackChunkName: "about" */ '../views/新建车次/AddTrain.vue'
          ),
      },
      {
        path: '/addCircuit',
        name: 'addCircuit',
        component: () =>
          import(
            /* webpackChunkName: "about" */ '../views/新建线路/AddCircuit'
          ),
      },
      {
        path: '/AddTicket',
        name: 'AddTicket',
        component: () =>
          import(/* webpackChunkName: "about" */ '../views/新建车票/AddTicket'),
      },
    ],
  },
  {
    path: '/Login',
    name: 'Login',
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/登录/Login.vue'),
  },
  {
    path: '/Reg',
    name: 'Reg',
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/注册/Reg.vue'),
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

export default router
